//
//  Statistics3PLCell.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2021/6/23.
//  Copyright © 2021 吕晶. All rights reserved.
//

#import "Statistics3PLCell.h"

@interface Statistics3PLCell ()

@property (nonatomic, strong) UILabel *line1;
@property (nonatomic, strong) UILabel *addressLab;
@property (nonatomic, strong) UILabel *nameLab;
@property (nonatomic, strong) UIImageView *arrowImgView;
@property (nonatomic, strong) UILabel *line2;

@end

@implementation Statistics3PLCell

+ (instancetype)Statistics3PLCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"Statistics3PLCell";
    Statistics3PLCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[Statistics3PLCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = HexColor(0xffffff);
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.line1 = [[UILabel alloc] initWithFrame:CGRectMake(12, 15, 6, 30)];
        self.line1.backgroundColor = Color_ThemeColor;
        self.line1.layer.masksToBounds = YES;
        self.line1.layer.cornerRadius = 2;
        [self.contentView addSubview:self.line1];
        
        self.line2 = [[UILabel alloc] initWithFrame:CGRectMake(12, self.line1.nim_bottom + 14.5, ScreenW - 30 - 24, 0.5)];
        self.line2.backgroundColor = HexColorA(0x707070, 0.2);
        [self.contentView addSubview:self.line2];
        
        self.arrowImgView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenW - 30 - 12 - 18, (60 - 18) * 0.5, 18, 18)];
        self.arrowImgView.image = [UIImage imageNamed:@"icon_home_arrow"];
        [self.contentView addSubview:self.arrowImgView];
        
        self.addressLab = [[UILabel alloc] initWithFrame:CGRectMake(self.line1.nim_right + 20, self.line1.nim_top, self.arrowImgView.nim_left - 10 - (self.line1.nim_right + 20), 12)];
        self.addressLab.font = [UIFont systemFontOfSize:11];
        self.addressLab.textColor = HexColor(0x666666);
        [self.contentView addSubview:self.addressLab];
        
        self.nameLab = [[UILabel alloc] initWithFrame:CGRectMake(self.line1.nim_right + 20, self.addressLab.nim_bottom + 4, self.arrowImgView.nim_left - 10 - (self.line1.nim_right + 20), 14)];
        self.nameLab.font = BoldFontOfSize(13);
        self.nameLab.textColor = HexColor(0x666666);
        [self.contentView addSubview:self.nameLab];
        
        self.height = self.line2.nim_bottom;
    }
    return self;
}

-(void)setModel:(Statistics3PLModel *)model {
    _model = model;
    self.addressLab.text = model.address;
    self.nameLab.text = model.name;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
